<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
		  <#assign base=request.contextPath  />
    <link rel="stylesheet" href="${base}/js/layui/css/layui.css?t=1534970980648" media="all">
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script src="${base}/js/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${base}/js/ztree/jquery-1.4.4.min.js"></script>
    <script src="${base}/js/jquery.min.js"></script>

    <style type="text/css">
        form{
            padding:50px;
        }
        .layui-btn-radius{
            border-radius: 5px;
        }
    </style>
</head>
<body>


<form class="layui-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;物品名称</label>
            <div class="layui-input-inline">
                <input name="item_names" id="itemName" lay-verify="required" autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;所需部门</label>
            <div class="layui-input-inline">
                <input name="departments" id="department" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;数量</label>
            <div class="layui-input-inline">
                <input name="amounts" id="amount" lay-verify="required" autocomplete="off" class="layui-input isNull " type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;规格</label>
            <div class="layui-input-inline">
                <input name="item_names" id="company" lay-verify="required" autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;领料人</label>
            <div class="layui-input-inline">
                <input name="item_names" id="people" lay-verify="required" autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" > 备注</label>
            <div class="layui-input-inline">
                <input name="item_names" id="remarks"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-radius" lay-submit lay-filter="formDemo" type="button" onclick="pickSubmit()" style="background-color: #0092EF;">出库</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius">重置</button>
            </div>
        </div>
    </div>
</form>


<script>
    layui.use(['form', 'layedit', 'laydate','layer'], function(){
        var form = layui.form
                ,layer = layui.layer
                ,layedit = layui.layedit
                ,laydate = layui.laydate;
        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });


    });

    function pickSubmit(){
        if(!isNull()){
            return
        }

        if(!isNum()){
            return
        }

        var jsonData={};
        jsonData.number=$("#amount").val();
        jsonData.department=$("#department").val();
        jsonData.itemName=$("#itemName").val();
        jsonData.people=$("#people").val();
        jsonData.company=$("#company").val();
        jsonData.remarks=$("#remarks").val();
        jsonData.type=$("#type").val();
        if(!isNull()){
            return;
        }

        $.ajax({
            type:"POST",
            url:"${base}/stockRemoval/insertStockRemoval",
            data:{"param":JSON.stringify(jsonData)},
            success : function(data){
                layer.msg(data);
                setTimeout(function(){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                },500);

                var table = parent.layui.table;
                //表刷新方法
                table.reload('testReload', {
                    url: '${base}/stockRemoval/list'
                    ,where: {} //设定异步数据接口的额外参数
                    //,height: 300
                });


            }
        });
    }
</script>
</body>
</html>
